package cn.wolfcode.luowowo.search.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

/**
 * Created by Administrator on 2019/7/16.
 */
@Getter
@Setter
public class SearchQueryObject extends QueryObject{
    public static final int CONDITION_TYPE_ABROAD=0;
    public static final int CONDITION_TYPE_UN_ABROAD=1;
    public static final int CONDITION_TYPE_THEME=2;
    private String orderBy = "viewnum";
    private Long destId = -1L;
    private String destName = "";
    private int type = -1;
    private int typeValue = -1;
    public Pageable getPageable(){
        return PageRequest.of(super.getCurrentPage()-1,super.getPageSize(), Sort.Direction.DESC,orderBy);
    }
    public Pageable getPageablewithoutSort(){
        return PageRequest.of(super.getCurrentPage()-1,super.getPageSize());
    }
}
